#include <windows.h>
#include <tchar.h>

#include "CCStdC.h"

#include "GameApp.h"

//#include <vld.h>


int APIENTRY _tWinMain(HINSTANCE hInstance,
					   HINSTANCE hPrevInstance,
					   LPTSTR    lpCmdLine,
					   int       nCmdShow);

int _tmain(int argc, _TCHAR* argv[])
{

	HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
	HINSTANCE hPreInstance = NULL;
	TCHAR szCmdLine[1024];
	szCmdLine[0] = 0;
	LPTSTR lpCmdLine = szCmdLine;
	for ( int i = 1; i < argc; i++ )
	{
		if ( i > 1 )
		{
			_tcscpy(lpCmdLine, _T(" "));
			lpCmdLine = lpCmdLine + _tcslen(_T(" "));
		}
		_tcscpy(lpCmdLine, argv[i]);
		lpCmdLine = lpCmdLine + _tcslen(argv[i]);
	}
	lpCmdLine = szCmdLine;
	int nCmdShow = SW_SHOWNORMAL;


	int ret = _tWinMain(hInstance, hPreInstance, lpCmdLine, nCmdShow);
	return 0;
}



int APIENTRY _tWinMain(HINSTANCE hInstance,
					   HINSTANCE hPrevInstance,
					   LPTSTR    lpCmdLine,
					   int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	// create the application instance
	CGameApp app;

	return cocos2d::CCApplication::sharedApplication().run();
}